import axios from '@/lib/http'


export const Api= {
    //注册账号获取验证码的api
    RegisterCode(iphone) {
        return axios.post("api/user/sms.php", {
            phone: iphone
        })
    },
    //注册账号Api
    setRegisteruser(form) {
        return axios.post("api/user/register.php", {
            username: form.name,
            password: form.password,
            confirmPassword: form.password2,
            phone: form.iphone,
            smsCode: form.code
        })
    },
    //登录的api
    login(form) {
        return axios.post("api/login.php", {
            phone: form.iphone,
            password: form.password,
        })
    }, //验证token获取用户数据列表等待修改
    verifytoken(params) {
        return axios.get("api/user/currentUser.php", {
            headers: {
                phone: params.phone,
                token: params.token
            }
        })
    },
    //获取个人信息在Home界面调用
    personal(){
         return axios.get("/api/user/currentUser.php")
    },
    //退出登入接口
    outLogin(){
        return axios.get("/api/user/userOut.php")
    },
    //修改用户信息
    CurrentUser(params){
        return axios.post("/api/user/modifyingCurrentUser.php",params)
    }
  



}

export const uploading= {
    //上传图片的
    upload(formdata){
        return  axios.post("/api/common/filesUpload.php",formdata)
    },
    //头像上传
    portrait(url){
        return  axios.post("/api/user/upLoadAvatar.php",{
            avatarUrl:url
        })
    }

}
 //文章的的接口管理
export const article={
    //获取文章 如果传参就是查询接口
    article(data){
        return axios.post("/api/art/list.php",data)
    },
    //添加文章
    addarticle(data){
        return axios.post("/api/art/post.php",data)
    },
    //文章的分类界面
    classify(params={}){
        return axios.get("/api/category/list.php",params)
    },
    //添加分类
    addclassify(params){
        return axios.post("/api/category/post.php",params)
    }
   
}


